﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace House_Control
{
    //This class will deal with Televisions in the house.
    class Television : Appliance
    {
        //If you can't figure out what these variables are for, just kill yourself. Seriously.
        int channel;
        int volume;
        //We need this variable for when we call the base class constructor.
        static int applianceType = Appliance.TELEVISION;

        //In C#, you use : base() to call the constructor of the base class and in this case the constructor takes applianceType as an argument.
        public Television() : base(applianceType)
        {
            channel = 0;
            volume = 0;
        }

        public void incChannel()
        {
            channel++;
            chanCheck();
        }

        public void decChannel()
        {
            channel--;
            chanCheck();
        }

        public void incVolume()
        {
            volume++;
            volCheck();
        }

        public void decVolume()
        {
            volume--;
            volCheck();
        }

        public int getChannel()
        {
            return channel;
        }

        public void setChannel(int newChan)
        {
            channel = newChan;
            chanCheck();
        }

        public int getVolume()
        {
            return volume;
        }

        public void setVolume(int newVol)
        {
            volume = newVol;
            volCheck();
        }

        //These methods make sure volume and channel do not get outside of set bounds.
        public void volCheck()
        {
            if (volume < 0) volume = 0;
            if (volume > 100) volume = 100;
        }

        public void chanCheck()
        {
            if (channel < 1) channel = 1;
            if (channel > 700) channel = 700;
        }
    }
}
